import cn.edu.hbsi.dao.ProductDao;
import cn.edu.hbsi.domain.Product;
import cn.edu.hbsi.utils.GetSqlSessionUtil;
import org.apache.ibatis.session.SqlSession;
import org.junit.After;
import org.junit.Test;

import java.util.Iterator;
import java.util.List;

public class testProduct
{
    private SqlSession sqlSession = GetSqlSessionUtil.getSqlSession();
    private ProductDao productDao = sqlSession.getMapper(ProductDao.class);

    @Test
    public void testSelectProductByPId(){
        List<Product> list = productDao.selectProductByPId(1);

        Iterator var = list.iterator();
        while (var.hasNext()){
            Product product = (Product) var.next();
            System.out.println(product);
        }
    }

    @After
    public void destory(){
        sqlSession.commit();
        sqlSession.close();
    }
}
